<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 5/18 0018
 * Time: 16:28
 */

namespace App\Http\Controllers;

use App\Http\Model\ShopCategories;
use Illuminate\Http\Request;

use App\Http\Requests;
use Illuminate\Support\Facades\DB;

class ShopsCategoriesController extends Controller
{
    public function index()
    {
        //$Shops=ShopCategories::all();
        $Shops=ShopCategories::where('ParentCategoryId', '-1')
                   ->get()
                    ->each(function($v,$k){
                       $children = ShopCategories::where('ParentCategoryId',$v->Id )->get();
                        $v->children = $children;
                    });
        /*->toArray();
        ->toJson();*/


        return json_success('1',$Shops);
    }

}